<template> 
	<ls-page title='首页' :userIdentity='0' leftIcon='' :autoBack='false'>
		<!-- <view style="color: red;">首页内容</view> -->
		
	        <button @click="wxLogin">微信授权登录</button>

	</ls-page>  
</template>

<script setup> 
	import { onLoad, onShow } from '@dcloudio/uni-app';
	onLoad((options) => {
		//   
	});
	onShow(() => {
		//  
	});
	
	const  wxLogin = ()=> {
	      // 1. 获取微信公众号的AppID
	      const appid = 'YOUR_APPID';
	 
	      // 2. 设置回调URL（需在微信公众号平台配置）
	      const redirect_uri = encodeURIComponent('https://yourdomain.com/wx-callback'); 
	 
	      // 3. 构造微信授权URL
	      const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`;
	 
	      // 4. 跳转到微信授权页面
	      window.location.href = url;
	    }

</script>

<style scoped lang="less">
	 

</style>